/****************************************************************************/
/* File: scs-action.h                                                       */
/* Desc: Specification file for the input action type                       */
/* Created: 2014-11-11                                                      */
/* Revised: 2014-11-22                                                      */
/* Authors: Sterling P. de Mille                                            */
/****************************************************************************/

// include once
#ifndef _SCS_ACTION_H_
#define _SCS_ACTION_H_

// core data types
#include "../Core/scs-types.h"

#define SCS_DEVICE_KEYBOARD 0x10000000
#define SCS_DEVICE_MOUSE 0x20000000
#define SCS_DEVICE_CONTROLLER 0x30000000
#define SCS_DEVICE_MASK 0xf0000000

#define SCS_ACTION_PRESS 0x01000000
#define SCS_ACTION_PRESSED 0x02000000
#define SCS_ACTION_PULL SCS_ACTION_PRESS
#define SCS_ACTION_PULLED SCS_ACTION_PRESSED
#define SCS_ACTION_RELEASE 0x03000000
#define SCS_ACTION_RELEASED 0x04000000
#define SCS_ACTION_MOVE 0x05000000
#define SCS_ACTION_POSITION 0x06000000
#define SCS_ACTION_SCROLL 0x07000000
#define SCS_ACTION_MASK 0x0f000000

#define SCS_INPUT_DPAD 0x00100000
#define SCS_INPUT_BUTTON 0x00200000
#define SCS_INPUT_KEY SCS_INPUT_BUTTON
#define SCS_INPUT_AXIS 0x00300000
#define SCS_INPUT_WHEEL 0x00400000
#define SCS_INPUT_MASK 0x00f00000

#define SCS_DIRECTION_UP 0x00000100
#define SCS_DIRECTION_DOWN 0x00000200
#define SCS_DIRECTION_LEFT 0x00000400
#define SCS_DIRECTION_RIGHT 0x00000800

#define SCS_DIRECTION_MASK 0x00000f00
#define SCS_KEYCODE_MASK 0x0000ffff
#define SCS_BUTTON_MASK 0x0000001f
#define SCS_AXIS_MASK 0x00000007
#define SCS_DPAD_MASK 0x0000000f

// input action type
class SCSaction
{
protected:

	SCSstring m_sLabel;
	SCSint m_iButtonBehavior;
	SCSint m_iInputValue;
	SCSint m_iOutputValue;
	SCSbool m_iEnabled;
	SCSint m_iState;

	SCSint ProcessOutputValue ();

public:

	const static SCSint CONTINUOUS_ACTION = 0;
	const static SCSint SINGLE_ACTION = 1;

	const static SCSint INACTIVE = 0;
	const static SCSint SELECTED = 1;
	const static SCSint DESELECTED = 2;
	const static SCSint ACTIVE = 3;

	SCSaction ();

	void Init (const SCSstring sLabel, const SCSint iButtonBehavior);

	SCSstring GetLabel () const;
	void SetLabel (const SCSstring sLabel);
	SCSint GetButtonBehavior () const;
	void SetButtonBehavior (const SCSint iButtonBehavior);

	void Reset ();

	void Tap ();
	void Activate ();
	void Activate (const SCSint iValue);
	void Deactivate ();

	void Update ();
	SCSbool Enabled () const;
	SCSint Value () const;
};


#endif // _SCS_ACTION_H_
